const fn = (v: boolean) => {
  if (v)
    return 1
  else
    return 2
}

type MyReturnTypeResult = MyReturnType<typeof fn> // 应推导出 "1 | 2"

// 注意 任何值可以赋给unknown unknown只能赋给any和unknown 
type MyReturnType<F> = F extends (...args: any[]) => infer R ? R : never